// component/userStatusDialog/userStatusDialog.js
Component({
  /**
   * 组件的配置
   */
  options: {
    styleIsolation: 'isolated',
    pureDataPattern: /^_/
  },

  /**
   * 组件的属性列表
   */
  properties: {
    dialog: {
      type: String,
      value: ''
    },
    isKeep: {
      type: Boolean,
      value: false
    }
  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的生命周期
   */
  lifetimes: {
    attached: function () {
      this.initData()
    },
    detached: function () {
      // 在组件实例被从页面节点树移除时执行
    },
  },

  /**
   * 组件的方法列表
   */
  methods: {
    initData() {
      this.myData = {
        confirm: function () {},
        cancel: function () {},
      }
    },

    clean() {
      this.myData.confirm = function () {}
      this.myData.cancel = function () {}
      this.setData({
        dialog: '',
        isKeep: false,
      })
    },

    onCancel() {
      if (!this.data.isKeep) {
        this.setData({
          dialog: '',
        })
      }
      this.myData.cancel()
    },

    onConfirm() {
      if (!this.data.isKeep) {
        this.setData({
          dialog: ''
        })
      }
      this.myData.confirm()
    },

    onTouchMove() {
      return false
    },

  }
})